<link href="../css/validationEngine.jquery.css" rel="stylesheet" type="text/css" />
<link href="../css/jquery-ui.css" rel="stylesheet" type="text/css" />
<link href="../css/table.css" rel="stylesheet" type="text/css" />

<script src="../js/jquery.min.js" type="text/javascript"></script>
<script src="../js/jquery-1.4.4.min.js" type="text/javascript"></script>
<script src="../js/jquery.validationEngine-en.js" type="text/javascript"></script>
<script src="../js/jquery.validationEngine.js" type="text/javascript"></script>
<script src="../js/jquery-ui.min.js" type="text/javascript"></script>

<script>	
$(document).ready(function() {
	$( "#datepicker" ).datepicker({ changeYear: true,changeMonth: true,dateFormat: "yy-mm-dd",dayNamesMin: ["Mg", "Sn", "Sl", "Rb", "Km", "Jm", "Sa"],monthNamesShort: ["Jan","Feb","Mar","Apr","Mei","Juni","Juli","Agus","Sept","Okt","Nov","Des"],showAnim: "blind" });
	$( "#datepicker2" ).datepicker({ changeYear: true,changeMonth: true,dateFormat: "yy-mm-dd",dayNamesMin: ["Mg", "Sn", "Sl", "Rb", "Km", "Jm", "Sa"],monthNamesShort: ["Jan","Feb","Mar","Apr","Mei","Juni","Juli","Agus","Sept","Okt","Nov","Des"],showAnim: "blind" });
	$("#formID").validationEngine();
});

var auto_refresh = setInterval(
function (){
	$('#expiredSite').load('expiredSite.php').fadeIn("slow");
}, 5000); 
</script>

<?php
include "../inc/db.php";
$id_site=$_GET['id_site'];
if(isset($id_site)){
	$sql="select * from tb_site where id_site='$id_site';";
	$hasil=mysql_query($sql);
	$kolom=mysql_fetch_array($hasil);
}

$hal=$_GET['hal'];
if(!isset($hal)){
	$hal=1;
}

$nav=$_GET['nav'];
if (!isset($nav)){
$page=1;	
}else{
$page=$nav;
}
$result="select count(*) from tb_site";
$row=mysql_fetch_array(mysql_query($result));
$halaman=5;
$banyak=ceil($row[0]/$halaman);
$awal=($page-1)*$halaman;

$result = mysql_query("select * from tb_site LIMIT $awal, $halaman");
?>

<title>Data Site</title>
<body onLoad="detailHide();">
<?php 
if($row[0]>=1){
?>
    <h2>DATA SITE</h2>
	
	</br>
	</br>
    <table width="680" class="bordered">
      <tr>
        <td width="60">Nama Site </td>
        <td width="67">Tgl Kontrak</td>
        <td width="67">Tgl Habis Kontrak</td>
        <td width="64">Lokasi Site</td>
        <td width="52">Kota</td>
        <td width="89">Keterangan 1</td>
        <td width="73">Keterangan 2</td>
       
      </tr>
      <?php
      while($kolom=mysql_fetch_array($result)){
      ?>
      <tr>
        <td><?php echo $kolom[1]; ?></td>
        <td><?php echo $kolom[2]; ?></td>
        <td><?php echo $kolom[3]; ?></td>
        <td><?php echo $kolom[4]; ?></td>
        <td><?php echo $kolom[5]; ?></td>
        <td><?php echo $kolom[6]; ?></td>
        <td><?php echo $kolom[7]; ?></td>
       
      </tr>
      <?php
      }
      ?>
</table>
<br>
	
	<br>
	Total Data : <?php echo $row[0]; ?>
    <br />
    
    <?php
    if($banyak>1){
        if($banyak<=5){
            $y=1;
            $x=$banyak;
        }else{
            if($page>5){
                $y=$page-4;
                $x=$page;
            }else{
                $y=1;
                $x=5;
            }
        }
        if ($page>1){
            echo "<a href=$_SERVER[PHP_SELF]?nav=1><< First</a> | ";
        }
        if (($page-1) > 0){
            $previous = $page-1;
                echo "<a href=$_SERVER[PHP_SELF]?nav=$previous>Previous</a> | ";	
        }
        for ($i=$y; $i<=$x; $i++){
            if ($i==$page){
                echo "<b>$i</b> |";
            }else {
                echo "<a href=$_SERVER[PHP_SELF]?nav=$i>$i</a> | ";
            }
            echo  " ";
        }
        if ($page < $banyak){
            $next=$page+1;
            echo "<a href=$_SERVER[PHP_SELF]?nav=$next>Next</a> | ";
        }
        if (($page != $banyak) && ($banyak != 0)){
            echo "| <a href=$_SERVER[PHP_SELF]?nav=$banyak>Last >></a> | ";
        }
    }
	
}else{
?>
<h2>DATA SITE NOT FOUND</h2>
<?php
}
?>
<br />
<br />


</body>